package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo06 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入英雄名字");
        String name = sc.nextLine();
        System.out.println("请输入价格");
        double money = sc.nextDouble();
       /* try (
                Connection con = DBUtils.getConn();
                ){
              Statement s = con.createStatement();
              s.executeUpdate("insert into hero values (null,'"+name+"',"+money+")");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }*/


        try(
                Connection con = DBUtils.getConn();
                ) {
            Statement s = con.createStatement();
             s.executeUpdate("insert into hero(name,money) values ('"+name+"',"+money+")");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

    }
}
